# -*- coding: utf-8 -*-

"""
闭包
"""


# def outer(logo):
#     def inner(msg):
#         nonlocal logo
#         print(f"<{logo}>{msg}<{logo}>")
#         logo = logo + msg
#     return inner
#
#
# fn1 = outer("姓名")
# fn1("沈煜宇")


def outer(logo=0):
    def inner(money, boo=True):
        nonlocal logo
        if boo:
            logo = logo + money
            print(f"存款：{money}，账户余额：{logo}")
        else:
            logo = logo - money
            print(f"取款：{money}，账户余额：{logo}")

    return inner


a = outer()
a(100)
a(200)
a(50, boo=False)
